home *** CD-ROM | disk | FTP | other *** search
- /* TNQuit.c -- XCMD to close the TN3270 driver
- copyright 1989 Cornell University
- */
-
-
- #include <Types.h>
- #include <Memory.h>
- #include <Devices.h>
- #include <HyperXCmd.h>
- #include <Errors.h>
-
- #include "TNdrvr.h"
-
-
- pascal void debugger() extern 0xA9FF;
-
-
- pascal void TNQuit(hycp)
- XCmdPtr hycp;
- {
- CntrlParam drvpb;
- long * args;
- Str255 pstr;
-
- if (hycp->paramCount != 1) {
- sethand(&hycp->returnValue, "TNQuit TNID: need 1 argument");
- return;
- }
-
- HLock((Handle) hycp->params[0]);
-
- ZeroToPas(hycp, *hycp->params[0], (StringPtr) &pstr[0]);
- drvpb.ioCRefNum = (short) StrToNum(hycp, (Str31 *) &pstr[0]);
- drvpb.csCode = HTN_QUIT;
- PBControl((ParmBlkPtr) &drvpb, (Boolean) 0);
-
- if (drvpb.ioResult) {
- /* close call failed */
- switch (drvpb.ioResult) {
- case HTNR_NOTN: {
- sethand(&hycp->returnValue, "TN is not running");
- break;
- }
- case badUnitErr: {
- sethand(&hycp->returnValue, "TNID is incorrect");
- break;
- }
- default: {
- sethand(&hycp->returnValue, "Unknown error");
- break;
- }
- }
- }
- HUnlock((Handle) hycp->params[0]);
- return;
- }
-
-
- sethand(thand, str)
- Handle * thand;
- char * str;
- {
- if (*thand == NULL) {
- *thand = NewHandle((Size) 0);
- }
- SetHandleSize(*thand, (long) (strlen(str) + 1));
- strcpy(**thand, str);
- }
-
-
-
-
- #include <XCmdGlue.inc.c>
-